package com.zx._09_架构.重构;

public class 重复代码的提炼 {

    class BadExample {

        public void someMethod1() {
            //code
            System.out.println("重复代码");/* 重复代码块 */
            //code
        }

        public void someMethod2() {
            //code
            System.out.println("重复代码");/* 重复代码块 */
            //code
        }
    }

    /* ---------------------分割线---------------------- */

    class GoodExample {

        public void someMethod1() {
            //code
            someMethod3();
            //code
        }

        public void someMethod2() {
            //code
            someMethod3();
            //code
        }

        public void someMethod3() {
            System.out.println("重复代码");/* 重复代码块 */
        }
    }
}

